package com.bkgy.jobs;

import com.bkgy.controller.outputRecord.service.IOutputRecordService;
import com.bkgy.controller.planking.service.IProfit1870JobService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * 早8点、晚19点执行
 * 1.镀锌生产效益分析，体现在表tb_profit1870_res表
 * 2.检查上一班是否破记录，最终体现在output_reocrd表
 */
@Slf4j
@Service
public class Profit1870Job {
    @Autowired
    public IProfit1870JobService jobService;
    @Autowired
    public IOutputRecordService breakRecordService;

    public void exec() {
        //任务1
        try {
            jobService.profit1870ResJob(new Date());
        }catch(Exception e) {
            log.error(e.getMessage(), e);
        }

        //任务2：检查上一班是否打破生产记录
        try{
            breakRecordService.buildRecordJob();
        }catch(Exception e) {
            log.error(e.getMessage(), e);
        }
    }
}
